package com.huasan.www.demon.data.service.impl;
import com.huasan.www.demon.util.OnePage;
import com.huasan.www.demon.util.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.huasan.www.demon.data.dao.DayDurationMapper;
import com.huasan.www.demon.data.service.DayDurationService;

import com.huasan.www.demon.pojo.DayDuration;
import com.huasan.www.demon.pojo.DayDurationExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;

@Service("dayDurationService")
public class DayDurationServiceImpl implements DayDurationService{
	
    @Autowired
    private DayDurationMapper dayDurationDao;    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table day_duration
     *
     * @mbggenerated Sun Feb 09 13:12:28 CST 2014
     */
    public int countByExample(DayDurationExample example){
      return dayDurationDao.countByExample(example);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table day_duration
     *
     * @mbggenerated Sun Feb 09 13:12:28 CST 2014
     */
    public int deleteByExample(DayDurationExample example){
      return dayDurationDao.deleteByExample(example);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table day_duration
     *
     * @mbggenerated Sun Feb 09 13:12:28 CST 2014
     */
    public int insert(DayDuration record){
      return dayDurationDao.insert(record);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table day_duration
     *
     * @mbggenerated Sun Feb 09 13:12:28 CST 2014
     */
    public int insertSelective(DayDuration record){
      return dayDurationDao.insertSelective(record);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table day_duration
     *
     * @mbggenerated Sun Feb 09 13:12:28 CST 2014
     */
    public List<DayDuration> selectByExample(DayDurationExample example){
      return dayDurationDao.selectByExample(example);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table day_duration
     *
     * @mbggenerated Sun Feb 09 13:12:28 CST 2014
     */
    public int updateByExampleSelective(@Param("record") DayDuration record, @Param("example") DayDurationExample example){
      return dayDurationDao.updateByExampleSelective(record,example);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table day_duration
     *
     * @mbggenerated Sun Feb 09 13:12:28 CST 2014
     */
    public int updateByExample(@Param("record") DayDuration record, @Param("example") DayDurationExample example){
      return dayDurationDao.updateByExample(record,example);
    }

    public OnePage<DayDuration> selectOnePageByExample(DayDurationExample example){
    	int count = dayDurationDao.countByExample(example);
    	List<DayDuration> dataList = dayDurationDao.selectByExample(example);
    	OnePage<DayDuration> onepage = new OnePage<DayDuration>();
    	onepage.setPage(new Page(example.getLimitStart(), example.getLimitEnd()));
    	onepage.getPage().setCount(count);
    	onepage.setDataList(dataList);
    	return onepage;
    }
}